<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery实现网页收藏</title>

<script language="javascript" type="text/javascript" src="js/jquery.js"></script>
</head>

<body>
<div class="topLinks">
  <span><a id="favorite" href="#" >添加收藏</a></span>
  <script language="javascript" type="text/javascript" > 
 //添加到收藏夹
 $(document).ready(function() {
   $("#favorite").click(function() {
    if ( window.ActiveXObject || "ActiveXObject" in window ) {
      window.external.addFavorite('http://www.baidu.com', '百度')
    } else  {
		alert('添加失败\n您可以尝试通过快捷键Ctrl+D加入到收藏夹~')
    } 
  })
});
</script>
</div>
</body>
</html>
